package com.moinut.studentattendancemanager.model.dao.proxy;

import com.moinut.studentattendancemanager.model.dao.ICourseInfoDAO;
import com.moinut.studentattendancemanager.model.dao.impl.CourseInfoDAOImpl;
import com.moinut.studentattendancemanager.model.vo.CourseInfo;

import java.util.List;

/**
 * @author MOILING
 */
public class CourseInfoDAOProxy extends BaseDAOProxy<CourseInfoDAOImpl> implements ICourseInfoDAO {

    @Override
    public List<CourseInfo> getCoursesInfoByStudentId(String studentId) throws Exception {
        List<CourseInfo> coursesInfo = this.dao.getCoursesInfoByStudentId(studentId);
        this.databaseConnection.close();
        return coursesInfo;
    }

    @Override
    public List<CourseInfo> getAllClass() throws Exception {
        List<CourseInfo> coursesInfo = this.dao.getAllClass();
        this.databaseConnection.close();
        return coursesInfo;
    }

    @Override
    public List<CourseInfo> getClassByTeacherId(String teacherId) throws Exception {
        List<CourseInfo> coursesInfo = this.dao.getClassByTeacherId(teacherId);
        this.databaseConnection.close();
        return coursesInfo;
    }

    @Override
    CourseInfoDAOImpl setDAOImpl() {
        return new CourseInfoDAOImpl(this.databaseConnection.getConnection());
    }
}
